import 'package:cgvc/page/home_page.dart';
import 'package:cgvc/page/web_view_page.dart';
import 'package:cgvc/view_model/theme_view_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

class RouterName {
  static const String web_view_page = 'web_view_page';
  static const String tab = 'tab';
}

class RouterManager {
  static Route<dynamic> generateRoute(RouteSettings settings) {
    switch (settings.name) {
      case RouterName.tab:
        return MaterialPageRoute(
            fullscreenDialog: true, builder: (context) => HomePage());
      case RouterName.web_view_page:
        var model = settings.arguments as String;
        return MaterialPageRoute(builder: (context) => WebViewPage(model));
      default:
        return MaterialPageRoute(
            builder: (context) => Scaffold(
                  body: Center(
                    child: Text(
                      'No route found for ${settings.name}',
                      textScaleFactor: ThemeViewModel.textScaleFactor,
                    ),
                  ),
                ));
    }
  }
}
